// import {
// 	global_data_handler
// } from '@/config/global_data_handler.js'


//活动信息
let activity_info = {
	title_status: '',
	title_baoming_start: '',
	title_baoming_end: '',
	title_huodong_time: '',
	title: '',
	address: '',
	content: '',
	title_status: '',
}



export let global_data_handler = function(key) {
	console.log('全局数据处理 key = ', key)
	switch (key) {
		case 'activity_info':
			return activity_info;
			break;
		case 'activity_info':
			return activity_info;
			break;
		default:
			break;
	}
} //





/**
 * @param {Object} data
 * 复制接口返回的新数据 并置空所有值
 var res = 
  cloneDataAndEmptyValue(res.data)
 */

let cloneDataAndEmptyValue = function(data, is_not_to_string) {
	var data_old = data
	var data_new = {}
	for (var key in data_old) {
		var value_old = data_old[key]
		var value_new = ''
		if (typeof value_old == 'string') {
			value_new = ''
		} else if (value_old === null) {
				value_new = ''
		} else if (typeof value_old == 'object') {
			if (Array.isArray(value_old)) {
				value_new = []
				// value_new = cloneDataAndEmptyValue(value_old, 1)
			} else {
				// value_new = {}
				value_new = cloneDataAndEmptyValue(value_old, 1)
			}
		}
		data_new[key] = value_new;
	}

	let info = null;
	if (is_not_to_string) {
		info = data_new;
	} else {
		info = JSON.stringify(data_new)
		console.warn(info)
	}
	return info
}






